ef43a7fd23e1457d99489c6e6d962d21f919470e,opennms-services/src/main/java/org/opennms/netmgt/threshd/SnmpThresholder.java,SnmpThresholder,checkResourceDir,#File#SnmpThresholdNetworkInterface#Date#Events#,513

Before Change


                if (log().isDebugEnabled()) {
                    log().debug("checkResourceDir: resource=" + resource);
                }
                processThresholdForResource(file, snmpIface, date, events, thresholdMap.get(threshKey), resource);
            }
        }
    }

After Change


        }
    }

    protected void checkResourceDir(File directory, SnmpThresholdNetworkInterface snmpIface, Date date, Events events) throws IllegalArgumentException {
        // TODO: do more specific and thorough assertions on arguments

        // Sanity Check
        if (directory == null || snmpIface.getNodeId() == null || snmpIface.getInetAddress() == null || date == null || events == null) {
            throw new IllegalArgumentException("Null parameters not permitted.");
        }

        if (log().isDebugEnabled()) {
            log().debug("checkResourceDir: threshold checking generic resource dir: " + directory.getAbsolutePath());
        }
        
        String resourceType = directory.getName();
        
        if (!directory.exists()) {
        	log().debug("Aborting check because this node does not support Resource Type " + resourceType);
        	return;
        }

        SnmpThresholdConfiguration config = snmpIface.getThresholdConfiguration(); 
        if (log().isDebugEnabled()) {
            log().debug("checkResourceDir: group="  + config.getGroupName() + ", resourceType=" + resourceType);
        }
        
        ThresholdResourceType thresholdResourceType = config.getGenericResourceTypeMap().get(resourceType);
        if (thresholdResourceType == null) {
            log().info("No generic resources for group " + config.getGroupName());
            return;
        }
        Map<String, ThresholdEntity> thresholdMap = thresholdResourceType.getThresholdMap();
        
        File[] files = directory.listFiles();
        for (File file : files) {
            String resource = file.getName();
            for(String threshKey  :thresholdMap.keySet()) {
                if (log().isDebugEnabled()) {
                    log().debug("checkResourceDir: resource=" + resource);
                }
                String dsLabelValue = getDataSourceLabel(file, snmpIface, thresholdMap.get(threshKey));
                processThresholdForResource(file, snmpIface, date, events, thresholdMap.get(threshKey), dsLabelValue);
            }
        }
    }